<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>
    let obj = {
        name: "小明"
    }

    /* function A() {
        // 'use strict'
        console.log(this.name); // this => undefined
        // 没开严格模式前不输出
        // 严格模式下报错输出：Uncaught TypeError: Cannot read property 'name' of undefined
    }
    A(); */

    function A() {
        console.log(this);//obj
        console.log(this.name); //小明
    }
    A();
    // bind => 返回一个函数
    let bindAFunc = A.bind(obj);
    bindAFunc(); //小明

    // call => 立即执行 传入的参数 参数列表
    A.call(obj,1,2,3,4);// 小明

    A.apply(obj,[1,2,3,4,5]);//小明
</script>

</html>